<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Deepfake检测 - 人脸活体检测系统</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            color: #333;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }

        .header {
            text-align: center;
            margin-bottom: 30px;
            color: white;
        }

        .header h1 {
            font-size: 2.5rem;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .header p {
            font-size: 1.1rem;
            opacity: 0.9;
        }

        .nav-bar {
            background: white;
            border-radius: 15px;
            padding: 15px 20px;
            margin-bottom: 30px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .nav-brand {
            font-size: 1.5rem;
            font-weight: bold;
            color: #333;
        }

        .nav-links {
            display: flex;
            gap: 20px;
        }

        .nav-link {
            color: #667eea;
            text-decoration: none;
            font-weight: 600;
            padding: 8px 16px;
            border-radius: 8px;
            transition: all 0.3s ease;
        }

        .nav-link:hover {
            background: #f0f0f0;
        }

        .main-content {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
            margin-bottom: 30px;
        }

        .upload-section {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        }

        .upload-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .upload-header h2 {
            color: #333;
            font-size: 1.8rem;
            margin-bottom: 10px;
        }

        .upload-header p {
            color: #666;
            font-size: 0.9rem;
        }

        .upload-form {
            margin-bottom: 30px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            color: #555;
            font-weight: 600;
        }

        .form-control {
            width: 100%;
            padding: 12px 15px;
            border: 2px solid #e1e5e9;
            border-radius: 8px;
            font-size: 1rem;
            transition: border-color 0.3s ease;
        }

        .form-control:focus {
            outline: none;
            border-color: #667eea;
        }

        .btn {
            padding: 12px 24px;
            border: none;
            border-radius: 8px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .btn-success {
            background: linear-gradient(45deg, #28a745, #20c997);
            color: white;
        }

        .btn-success:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
        }

        .history-section {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        }

        .history-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .history-header h2 {
            color: #333;
            font-size: 1.8rem;
            margin-bottom: 10px;
        }

        .history-item {
            display: flex;
            align-items: flex-start;
            padding: 20px;
            background: #f8f9fa;
            border-radius: 10px;
            margin-bottom: 15px;
            border-left: 4px solid #667eea;
        }

        .history-item img {
            width: 80px;
            height: 80px;
            object-fit: cover;
            border-radius: 8px;
            margin-right: 15px;
        }

        .history-content {
            flex: 1;
        }

        .history-filename {
            font-weight: bold;
            color: #333;
            margin-bottom: 8px;
        }

        .history-analysis {
            color: #666;
            font-size: 0.9rem;
            line-height: 1.5;
            white-space: pre-wrap;
        }

        .history-timestamp {
            color: #999;
            font-size: 0.8rem;
            margin-top: 8px;
        }

        .alert {
            padding: 12px 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            font-size: 0.9rem;
        }

        .alert-warning {
            background: #fff3cd;
            color: #856404;
            border: 1px solid #ffeaa7;
        }

        .alert-success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }

        .alert-danger {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }

        .empty-state {
            text-align: center;
            color: #666;
            padding: 40px 20px;
        }

        .empty-state p {
            font-size: 1.1rem;
            margin-bottom: 10px;
        }

        @media (max-width: 768px) {
            .main-content {
                grid-template-columns: 1fr;
            }
            
            .nav-bar {
                flex-direction: column;
                gap: 15px;
            }
            
            .header h1 {
                font-size: 2rem;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>Deepfake检测系统</h1>
            <p>基于AI的智能图像真实性检测</p>
        </div>

        <div class="nav-bar">
            <div class="nav-brand">人脸活体检测系统</div>
            <div class="nav-links">
                <a href="{{ url_for('index') }}" class="nav-link">活体检测</a>
                <a href="{{ url_for('upload_page') }}" class="nav-link">Deepfake检测</a>
                <a href="{{ url_for('logout') }}" class="nav-link">登出</a>
            </div>
        </div>

        <div class="main-content">
            <div class="upload-section">
                <div class="upload-header">
                    <h2>上传图片检测</h2>
                    <p>上传图片进行Deepfake检测分析</p>
                </div>

                {% with messages = get_flashed_messages(with_categories=true) %}
                    {% if messages %}
                        {% for category, message in messages %}
                            <div class="alert alert-{{ category }}">{{ message }}</div>
                        {% endfor %}
                    {% endif %}
                {% endwith %}

                <form method="post" enctype="multipart/form-data" class="upload-form">
                    <div class="form-group">
                        <label for="file">选择图片文件</label>
                        <input type="file" id="file" name="file" class="form-control" accept="image/png, image/jpeg, image/gif" required>
                    </div>
                    <button type="submit" class="btn btn-success">上传并检测</button>
                </form>

                <div class="upload-info">
                    <h3>支持的格式</h3>
                    <ul>
                        <li>PNG 图片</li>
                        <li>JPEG/JPG 图片</li>
                        <li>GIF 图片</li>
                    </ul>
                    <h3>检测说明</h3>
                    <p>系统将使用AI模型分析图片，检测是否存在深度伪造（Deepfake）技术处理的痕迹。检测结果包括：</p>
                    <ul>
                        <li>判定为真实图片</li>
                        <li>疑似深度伪造</li>
                        <li>高度可信为深度伪造</li>
                    </ul>
                </div>
            </div>

            <div class="history-section">
                <div class="history-header">
                    <h2>检测历史</h2>
                    <p>查看您的历史检测记录</p>
                </div>

                {% if uploads %}
                    {% for upload in uploads %}
                    <div class="history-item">
                        <img src="{{ url_for('serve_upload', filename=upload.secure_filename) }}" alt="{{ upload.original_filename }}">
                        <div class="history-content">
                            <div class="history-filename">{{ upload.original_filename }}</div>
                            <div class="history-analysis">{{ upload.analysis_result }}</div>
                            <div class="history-timestamp">{{ upload.timestamp.strftime('%Y-%m-%d %H:%M') }}</div>
                        </div>
                    </div>
                    {% endfor %}
                {% else %}
                    <div class="empty-state">
                        <p>您还没有上传任何图片进行检测。</p>
                        <p>请在上方上传图片开始您的第一次检测。</p>
                    </div>
                {% endif %}
            </div>
        </div>
    </div>
</body>
</html> 